/*
 * Copyright (C) 2009 Kristopher T Babic
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of
 * the GNU General Public License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program;
 * if not, see <http://www.gnu.org/licenses>.
 */

package edu.idp.shared.net;

import edu.idp.shared.compress.Compress;

import java.io.IOException;
import java.net.Socket;

/**
 * @author Kristopher T Babic
 */
public class Connection {

    private Integer port;
    private String host;
    private Socket s;
    private Compress comp;

    public static int FIN = 0;
    public static int ZIP = 1;

    public Connection() {
        port = null;
        host = null;
        s = null;
    }

    public Connection(Socket s) {
        this();
        this.s = s;
    }

    public Connection(String host, Integer port) {
        this.host = host;
        this.port = port;
        this.s = null;
    }


    public void setHost(String h) {
        this.host = h;
    }

    public void setPort(Integer i) {
        this.port = i;
    }

    public void setSocket(Socket s) {
        this.s = s;
    }

    public void setCompression(Compress c) {
        this.comp = c;
    }

    public Socket getSocket() {
        return s;
    }

    public String getHost() {
        return host;
    }

    public Integer getPort() {
        return port;
    }

    public Compress getCompression() {
        return comp;
    }

    public void Connect() throws IOException {

        if (s == null)
            s = new Socket(host, port);

    }

    public void send(String data) {
    }

    public String read(String data) {
        // not implemented
        return null;
    }

    public void sendCompress(String data, Compress compTool) throws IOException {
        // not implemented
    }

    public String readCompress(String data, Compress compTool) throws IOException {
        // not implemented
        return null;
    }

}